function sendBookingRequest() {
	var checkin = document.getElementById("checkin");
	var checkout = document.getElementById("checkout");
	var no_nights = document.getElementById("no_nights");
	var roomcat = document.getElementById("cmbRoomCat");
	var roomtype = document.getElementById("cmbRoomType");
	var rooms = document.getElementById("no_rooms");
	var adult = document.getElementById("adult");
	var children = document.getElementById("children");
	var additional_info = document.getElementById("additional_info");
	var transfer_option = document.getElementById("transfer_option");
	var fullname = document.getElementById("fullname");
	var email = document.getElementById("email");
	var telephone = document.getElementById("telephone");
	var address = document.getElementById("address");
	var country = document.getElementById("country");
	var comments = document.getElementById("comments");
	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	var hotel_id = document.getElementById("txtHotelId").value;
	
	if(checkin.value == "") {
		alert("Please select the check-in date");
		checkin.focus();
		return false;
	} else if(checkout.value == "") {
		alert("Please select the check-out date");
		checkout.focus();
		return false;
	} else if(no_nights.value == "") {
		alert("Please enter number of nights you decide to stay in the hotel");	
		no_nights.focus();
		return false;
	} else if(rooms.value == "") {
		alert("Please enter number of rooms you want to reserve");
		rooms.focus();
		return false;	
	} else if(roomcat.selectedIndex == 0) {
		alert("Please select a room category");
		roomcat.focus();
		return false;
	} else if(roomtype.selectedIndex == 0) {
		alert("Please select a room type");
		rooms.focus();
		return false;
	} else if(adult.selectedIndex == 0) {
		alert("Please select any number of adults");
		adult.focus();
		return false;
	} else if(fullname.value == "") {
		alert("Please enter your name");
		fullname.focus();
		return false;
	} else if(email.value == "") {
		alert("Please enter your email address");
		return false;
	} else if(email.value != "" && reg.test(email.value) == false) {
        alert("Invalid email address");
        email.focus();
        return false;
    } else if(address.value == "") {
    	alert("Please enter your valid postal address");
        address.focus();
        return false;
    } else if(country.selectedIndex == 0) {
    	alert("Please select your country");
        country.focus();
        return false;
    } else {
    	$.ajax ({
	    	type: "POST",
	    	data: ({hotel_id:hotel_id, checkin: checkin.value, checkout: checkout.value, no_nights: no_nights.value, rooms: rooms.value, roomcat: roomcat.value, roomtype: roomtype.value, adult: adult.value, children: children.value, additional_info: additional_info.value, transfer_option: transfer_option.value, fullname: fullname.value, email: email.value, telephone: telephone.value, address: address.value, country: country.value, comments: comments.value}),
	    	url: "/default/hotel/sendbookingrequest/",
	    	success: function(data){
	    	   alert(data);
	    	   loadPage("/default/hotel/view/");	
	    	}
		});	
    }	 
}

function validatebookinform(lang)
{
	var sender_name = document.getElementById("sender_name");
	var sender_email =  document.getElementById("sender_email");
	var country = document.getElementById("cmbCountry");
	var city = document.getElementById("cmbCity");
	var hotel = document.getElementById("cmbHotel");
	var checkin = document.getElementById("date18");
	var checkout = document.getElementById("date10");
	var adults = document.getElementById("adults");
	var children = document.getElementById("children");
	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	var msg = '';
	if(sender_name.value == "") {
		if(lang == 'en') {
			msg = "Please enter your name";
		} else if(lang == 'ru') {
			msg = "????? ?? ????????? ?????????? ??????";
		}
		alert(msg);
		sender_name.focus();
		return false;
	} else if(sender_email.value == "") {
		alert("Please enter your email address");
		sender_email.focus();
		return false;
	} else if(sender_email.value != "" && reg.test(sender_email.value) == false) {
        alert("Invalid email address");
        sender_email.focus();
        return false;
    } else if(country.selectedIndex == 0) {
    	alert("Please select your country");
    	country.focus();
    	return false;
    } else if(city.selectedIndex == 0) {
    	alert("Please select your city");
    	city.focus();
    	return false;
    } else if(hotel.selectedIndex == 0) {
    	alert("Please select any hotel");
    	hotel.focus();
    	return false;
    } else if(checkin.value == "") {
    	alert("Please select a date you suppose to checked in");
    	checkin.focus();
    	return false;
    } else if(checkout.value == "") {
    	alert("Please select a date you suppose to checked out");
    	checkout.focus();
    	return false;
    } else {
    	return true;
    }
}

function doQuickSearch(lang) {
	var country = document.getElementById("hotel_country");
	var city = document.getElementById("hotel_city");
	var hotel = document.getElementById("cmbhotel");
	var msg = "";	
	
	if(country.selectedIndex == 0) {
		if(lang == 'en') {
			msg = "Please select country";
		} else if(lang == 'ru') {
			msg = "aaa??????????, ???????? ?????";
		}
		
		//alert(msg);
		document.write(msg);
		country.focus();
		return false;
	} else if(city.selectedIndex == 0) {
		alert("Please select city");
		city.focus();
		return false;
	} else if(hotel.selectedIndex == 0) {
		alert("Please select hotel");
		hotel.focus();
		return false;
	}
}